<?
require("config.php");
$langname = 'schedule';
require("header.php");

 function after ($this, $inthat)
   {
       if (!is_bool(strpos($inthat, $this)))
       return substr($inthat, strpos($inthat,$this)+strlen($this));
   };

   function before ($this, $inthat)
   {
       return substr($inthat, 0, strpos($inthat, $this));
   };

function between ($this, $that, $inthat)
   {
     return before($that, after($this, $inthat));
   };

?>











<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 

    <td width="186" valign="top"> 
      <?require("nav.php")?>
    </td>
    <td width="11"><img src="images/shim.gif" width="11" height="1"></td>
    <td valign="top"> 
      <?require("menu.php")?>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="right"><table width="100%" border="0">
              <tr> 
                <td height="50" class="header">&gt;&gt; Training Schedule</td>
              </tr>
            </table></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td><div align="right"><!--<a href="application_form.htm" target="_blank"><u>application form</u></a> | --><a href="print_schedule.php" target="_blank"><u>print schedule<br>
              <br>
              </u></a></div></td>
        </tr>
      </table>

 

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr align="center" bgcolor="7FA2C9"> 
                  <td width="43%" height="20" bgcolor="7FA2C9"><strong><font color="#FFFFFF">Course 
                    Name</font></strong></td>
                  <td width="18%" height="10" bgcolor="7FA2C9"><strong><font color="#FFFFFF">Trainer</font></strong></td>
                  <td width="13%" bgcolor="7FA2C9"><strong><font color="#FFFFFF"> 
                    Language</font></strong></td>
                  <td width="10%" bgcolor="7FA2C9"><strong><font color="#FFFFFF"> 
                    Start on</font></strong></td>
                  <td width="9%" bgcolor="7FA2C9"><strong><font color="#FFFFFF"> 
                    Country</font></strong></td>
                  <td width="7%">&nbsp;</td>
                </tr>
                <tr> 
                  <td colspan="6" bgcolor="7FA2C9">
				  <table width="100%" border="0" cellspacing="1" cellpadding="0">
<?

$table = "course_schedule";
$today=date("Y-m-d");
$field = array(

"id",
"name",
"datedetails",
"date",
"venue",
"country",
"currency",
"fee",
"order_index",
"course",
"course_link",
"trainer_link",
"country2",
);




$exp = "And expiring_date>'$today' order by date asc,order_index asc";

$r = limitQuery($table,$field,$exp);

$aryShow = array(array("index"=>"1","str"=>"Evening Seminars"),array("index"=>"2","str"=>"Training Courses"),array("index"=>"3","str"=>"Training Programs"),array("index"=>"4","str"=>"In-house Training"));

if ($r){
$num_r1 = 0;
$html_r1 = "";
$img_r1 = "";
for($k=0;$k<count($aryShow);$k++)
{
	$html_r1 = "";
	for ($i=0;$i<count($r);$i++){
	
		$tempq = "select details, type from course_basic where name='".$r[$i][9]."'";
		$tempr = myQuery($tempq);
		$trainer = between("Trainers:", "<br>", $tempr[0][0]);
		if (empty($trainer)) $trainer = between("Trainer:", "<br>", $tempr[0][0]);
		if ($tempr[0][1] == $aryShow[$k]["index"]) {
			$num_r1++;
			
			switch ($r[$i][5]) {
	
			  case "Denmark":
				$img_r1 = "<img src='images/danmai.gif' width='35' height='24'>";
				break;
				  case "Hong Kong":
				$img_r1 = "<img src='images/hk.gif' width='35' height='24'>";
				break;
				  case "China":
				$img_r1 = "<img src='images/china.gif' width='35' height='24'>";
				break;
				  case "Sweden":
				$img_r1 = "<img src='images/sweden.gif' width='35' height='24'>";
			
				break;
				default:
				$img_r1 = $r[$i][5];
				break;
			}
	        $CourseNameUrl = $r[$i][10];
			$CourseName = $r[$i][1];
			$TrainerUrl = $r[$i][11];
			$Language = $r[$i][12];
			$StartOn = $r[$i][3];
			$Pid = $r[$i][0];
			
			$html_r1 .= <<<EOT
						   <tr align="center" valign="middle" bgcolor="#FFFFFF"> 
							<td width="43%"><a href="$CourseNameUrl">$CourseName</a></td>
							<td width="18%" bgcolor="#FFFFFF"><a href="$TrainerUrl">$trainer</a></td>
							<td width="13%">$Language</td>
							<td width="10%">$StartOn</td>
							<td width="8%">$img_r1</td>
							<td width="8%" bgcolor="#FFFFFF">
							<a href="http://webshop.acuityworld.com/shopping_cart.php?act=addcourse&pid=$Pid"><br />
							enroll</a><br>
							  <a href="javascript:Redirect('training_schedule_detail.php?id=$Pid',3)">details<br />
							  </a> 
				&nbsp;</td>
						  </tr>
EOT;
		}//if ($tempr[0][1] == 1)
	}// for
	if($html_r1 !="")
	{
		$NameInTr = $aryShow[$k]["str"];
		$html_tmp_r1 = <<<EOT
		<tr bgcolor="EBEAEA"> 
                        <td height="20" colspan="6" bgcolor="EBEAEA"><strong> 
                          &nbsp;&nbsp;&nbsp;&nbsp;<font color="#333333" size="2">$NameInTr</font></strong></td>
       </tr>
EOT;
	  	$html_r1 = $html_tmp_r1.$html_r1;		
	}
	
	echo $html_r1;
	
}//foreach 
}//if ($r)

?>

                   </table></td>
                </tr>
              </table></td>
          </tr>
        </table>
  



</td>
    <td width="11"><img src="images/shim.gif" width="11" height="1"></td>
    <td width="173" valign="top">
	
	
<?require("list.php")?>	 
	  
	  
    </td>

  </tr>
</table>





<?require("footer.php")?>	